package com.mgee.netty.server.configure;
/*
 * package com.sstar.chat.server.configure;
 * 
 * import org.springframework.beans.factory.BeanFactory; import
 * org.springframework.beans.factory.annotation.Value; import
 * org.springframework.context.annotation.Bean; import
 * org.springframework.context.annotation.Configuration; import
 * org.springframework.data.mongodb.MongoDbFactory; import
 * org.springframework.data.mongodb.config.AbstractMongoConfiguration; import
 * org.springframework.data.mongodb.core.convert.DbRefResolver; import
 * org.springframework.data.mongodb.core.convert.DefaultDbRefResolver; import
 * org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper; import
 * org.springframework.data.mongodb.core.convert.MappingMongoConverter; import
 * org.springframework.data.mongodb.core.mapping.MongoMappingContext;
 * 
 * import com.mongodb.MongoClient; import com.mongodb.MongoClientURI;
 * 
 * @Configuration public class MongoDbConfig extends AbstractMongoConfiguration
 * {
 * 
 * @Value("${spring.data.username}") private String _dbUserName;
 * 
 * @Value("${spring.data.password}") private String _dbPassword;
 * 
 * @Value("${spring.data.mongodbIp}") private String _dbHost;
 * 
 * @Value("${spring.data.mongodbPort}") private int _dbPort;
 * 
 * @Value("${spring.data.mongodbDbname}") private String _dbName;
 * 
 * @Override public String getDatabaseName() { return _dbName; }
 * 
 * @Override
 * 
 * @Bean public MongoClient mongoClient() {
 * 
 * String connectionUrl = String.format("mongodb://%s:%s@%s:%d/%s", _dbUserName,
 * _dbPassword, _dbHost, _dbPort, _dbName); MongoClientURI connectionString =
 * new MongoClientURI(connectionUrl); return new MongoClient(connectionString);
 * 
 * }
 * 
 * @Bean public MappingMongoConverter mappingMongoConverter(MongoDbFactory
 * factory, MongoMappingContext context, BeanFactory beanFactory) {
 * DbRefResolver dbRefResolver = new DefaultDbRefResolver(factory);
 * MappingMongoConverter mappingConverter = new
 * MappingMongoConverter(dbRefResolver, context);
 * 
 * // Don't save _class to mongo mappingConverter.setTypeMapper(new
 * DefaultMongoTypeMapper(null));
 * 
 * return mappingConverter; } }
 */